package com.geek.gkfgw.web.controller.auth.login;

import com.geek.gkdoc.facade.DocMethod;
import com.geek.gkfgw.biz.controller.auth.login.LoginByAccountPwdAction;
import com.geek.gkfgw.facade.abs.Response;
import com.geek.gkfgw.facade.auth.login.LoginByAccountPwdRequest;
import com.geek.gkfgw.facade.auth.login.LoginByAccountPwdResponse;
import com.geek.gkfgw.web.anno.TokenIgnore;
import com.geek.gkfgw.web.model.BaseResponse;
import com.geek.gkmember.facade.login.LoginFacade;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <h1>权限登录控制器。</h1><br/>
 *
 * <h1><br/><a href="https://u.geekbang.org/subject/arch3/100614201">Java 业务架构实战营：https://u.geekbang.org/subject/arch3/100614201</a></h1><br/><h1><a href="https://gitee.com/ylimhhmily/BizArchPracticeCamp">Java 业务架构实战营代码地址：https://gitee.com/ylimhhmily/BizArchPracticeCamp</a></h1><br/><h1><a href="https://u.geekbang.org/subject/java4th/1001148?source=app_share">高级 Java 工程体系课 2023 版：https://u.geekbang.org/subject/java4th/1001148?source=app_share</a></h1><br/><h1><a href="https://time.geekbang.org/column/intro/100312101?tab=catalog">Dubbo 源码剖析与实战：https://time.geekbang.org/column/intro/100312101?tab=catalog</a></h1>
 *
 * @author hmilyylimh
 * ^_^
 * @version 0.0.1
 * ^_^
 * @date 2023/9/3 18:49
 */
@RestController
public class LoginController {

    @Autowired
    private LoginByAccountPwdAction loginByAccountPwdAction;

    @TokenIgnore
    @DocMethod(desc = "通过账号+密码登录", author = "hmilyylimh", version = "20230901")
    @PostMapping("/gkfgw/auth/login/loginByAccountPwd.json")
    public Response<LoginByAccountPwdResponse> loginByAccountPwd(@RequestBody LoginByAccountPwdRequest req){
        LoginByAccountPwdResponse response = loginByAccountPwdAction.loginByAccountPwd(req);
        return BaseResponse.ok(response);
    }
}
